package com.yjh.admin.config.data;

/**
 * 数据源上下文
 *
 * @author Lynch
 */
public class DataSourceContext {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();

    public static void setDataSource(String value) {
        contextHolder.set(value);
    }

    public static String getDataSource() {
        return contextHolder.get();
    }

    public static void clearDataSource() {//不关闭导致连接池两个数据源，其它接口偶尔就会请求到其它数据源报错，待研究.......
        contextHolder.remove();
    }
}
